package com.tian.controller;

import com.tian.common.CommonResult;
import com.tian.dto.PaymentChannel4ApiRespDto;
import com.tian.dto.PaymentChannelDto;
import com.tian.service.PaymentChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * {@code @description:} 支付渠道控制器
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-11-23 11:44
 * {@code @version:} 1.0
 */
@Slf4j
@RestController
@RequestMapping("/payment/channel")
public class PaymentChannelController {

    @Resource
    private PaymentChannelService paymentChannelService;

    @GetMapping("/list")
    public CommonResult<List<PaymentChannel4ApiRespDto>> list() {
        return paymentChannelService.getAllPaymentChannel();
    }

    @PostMapping("/add")
    public CommonResult<Boolean> add(@RequestBody PaymentChannelDto paymentChannelDto) {
        return paymentChannelService.addPaymentChannel(paymentChannelDto);
    }

    @PostMapping("/update")
    public CommonResult<Boolean> update(@RequestBody PaymentChannelDto paymentChannelDto) {
        return paymentChannelService.updatePaymentChannel(paymentChannelDto);
    }
}
